<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input id="btn1" value="">

    <select id="option">
    <option>+</option>
    <option>-</option>
    <option>*</option>
    <option>/</option>
    <option>%</option>
    </select>
    
    <input id="btn2" value="">
    <button id="btn">=</button>
    <input  id="btn3" value="">


    <script>
         var res1 = document.getElementById('btn1')
        var res2 = document.getElementById('btn2')

        var res3 = document.getElementById('btn3')
        var res = document.getElementById('btn')
        var res4 = document.getElementById('option')
  
      btn.onclick = function(){


          var num1 = res1.value
          var num2 = res2.value
          
          var a = res4.value
       
          if((num1 == '')||(num2 == '')){
              alert('请输入值')
          }else if(a === '+'){
            //   console.log(1);
              
            res3.value = Number(num1) + Number(num2)
            // console.log(num3);
            
          }else if(a === '*'){
            res3.value= Number(num1)* Number(num2)
          }
          else if(a === '-'){
            res3.value = Number(num1)- Number(num2)
          }
          else if(a === '/'){
            res3.value = Number(num1)/ Number(num2)
          }
          else if(a === '%'){
            res3.value = Number(num1)% Number(num2)
          }

          

        
      }

    

    </script>
</body>
</html>